define(function(require, exports){
	exports.onMain = function( boot, data, app ) {
		if(!app.routerValid('admin.plan')) {
			return;
		}

		var title = LANG('计划报表');
		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title:title,
			type: 'sidebar'
		});

		app.core.get('SYS_PLATFORM').setPlatform(title);

		con.createBusiness(data.name, 'plan/action/list.base', {
		}, function(mod, created){
			if(created){
				mod.reload();
			}
		});

	};

	exports.onEdit = function( boot, data, app ) {
		var id = +data.param;
		var auth = id ? 'plan.update,plan.info' : 'plan.add';

		if(!app.routerValid(auth)) {
			return;
		}

		var title = id ? LANG('编辑计划') : LANG('添加计划');
		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title: title,
			type: 'scroll'
		});

		app.core.get('SYS_PLATFORM').setPlatform(title);

		con.createBusiness(data.name, 'plan/action/edit.base', {
		}, function(mod) {
			mod.reset();
			if(id)
			{
				mod.load(id);
			}
		});

	};
	exports.onSaveas = function( boot, data, app ) {
		if(!app.routerValid('plan.update')) {
			return;
		}
		var id = +data.param;
		var title = LANG('计划另存为');

		if (!id) {
			app.alert(LANG('缺少计划ID'));
			return app.controller.navigate('');
		}

		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title: title,
			type: 'scroll'
		});

		var uri = 'plan/action/edit.base';

		app.core.get('SYS_PLATFORM').setPlatform(title);

		con.createBusiness(data.name, uri, {

		}, function(mod) {
			mod.reset().setIsEdit(true).load(id, true);
		});

	};
});